<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Cadastro de Pessoa</title>
</head>
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.2/jquery-ui.min.js"></script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.11.2/themes/cupertino/jquery-ui.css"/>
 
<script>
$(function() {
	$("#dataNascimento").datepicker({dateFormat: "dd/mm/yy"});
	
	$("#formCadastrar").submit(function(e){
	    e.preventDefault();

	    var pessoa = {
	            nome: $("#nome").val(),
	            email:$("#email").val(),
	            dataNascimento:$.datepicker.parseDate("dd/mm/yy", $("#dataNascimento").val())
	        };
	    
		$.ajax({
			url: $(this).attr("action"),
			data: JSON.stringify(pessoa),
			dataType: "json",
			type: "POST",
			contentType: "application/json",
			success:function(result){
				alert("SUCESSOS");
				document.location = "/gestaoExperienciaProfissional/listagem.html";
		  	},
		  	error: function(result) {
				alert("ERROR");
			}
	  	
	  	});
	});

	
});


</script>
<body>
	<form id="formCadastrar" action="/gestaoExperienciaProfissional/rest/pessoa/" method="POST">
		<div>
			<output>Nome:</output>
			<input id="nome" type="text" name="nome" /><br/>

			<output>Data Nascimento: </output>
			<input id="dataNascimento" type="text" name="dataNascimento" /><br/>

			<output>Email:</output>
			<input id="email" type="text" name="email" /><br/><br/>
			<input type="submit" value="salvar"/>
		</div>
	</form>
</body>
</html>